memory_alphafandomcom-20200223-history
Help:CategoryTree
The CategoryTree extension provides a dynamic view of the wiki's category structure as a tree. It uses to load parts of the tree on demand. CategoryTree was originally written by Daniel Kinzler as an external tool (see User: Duesentrieb/CategoryTree at Meta-Wiki). It was later integrated into the MediaWiki software with the help of Tim Starling. Usage CategoryTree can be used in three ways: * directly on the category pages, * as a "custom tag" (or "parser function") to show a category structure in-line on a wiki page, * and as a special page. The CategoryTree extension adds + or × "expand" widgets to the subcategories listed on category pages, where + indicates the presence of further subcategories and × indicates the absence of them. If Javascript is disabled, those widgets just do nothing. :''Note to bot users: bots and scripts that parse the HTML of category pages can use the notree URL parameter to force the traditional output. However, HTML output is generally not stable, so it is recommended to change your script to use query.php or api.php to fetch category listings and such.'' The tag Example: Memory Alpha images Memory Alpha images The custom tag is called . For example, if you put Foo on a wiki page, it will show the contents of category Foo as a dynamic tree on that page (see example to the right). The tag accepts the following attributes, using an HTML-like syntax: ;mode: determines which pages are shown in the tree. This may be overridden by the use of the namespaces option. Possible values: :;categories: show subcategories only (configuration constant CT_MODE_CATEGORIES) :;pages: show subcategories and pages, except images (configuration constant CT_MODE_PAGES), limited to 200 pages :;all: show all pages, subcategories, images, etc (configuration constant CT_MODE_ALL) :;parents: list parent categories instead of subcategories (configuration constant CT_MODE_PARENTS). This puts CategoryTree into "inverse" operation ;depth: determines how many levels of the tree are shown initially. Default is 1, 0 means only the root node. The maximum value depends on the mode specified, and on the $wgCategoryTreeMaxDepth option. ;hideroot: set this to "on" to hide the "root" node of the tree, i.e. the mention of category Foo from the example. ;hideprefix: determines when the namespace prefix should be hidden from entries in the tree. Possible values are: :;always: always hide the prefix. Should be used only if all pages come from the same namespace (configuration constant CT_MODE_CT_HIDEPREFIX_ALWAYS) :;never: never hide the namespace prefix, not even for categories (configuration constant CT_MODE_CT_HIDEPREFIX_NEVER) :;auto: hide the namespace of categories, if only categories are shown, as with mode="categories" (configuration constant CT_MODE_CT_HIDEPREFIX_AUTO) :;categories: always hide the namespace of categories, but show all other prefixes (configuration constant CT_MODE_CT_HIDEPREFIX_CATEGORIES); this is the default behavior ;showcount: set this to "on" to show the number of entries in subcategories, i.e. showcount="on". This is disabled by default for category trees inlined on pages, but enabled by default in category listings and on Special:CategoryTree. ;namespaces: a list of namespaces from which pages should be shown in the tree. The entries in the list must be namespace names, separated by spaces. The main namespaces can be represented by "-" or "0". This overrides the mode option. ;class, style, id, etc.: The < tag supports all standard HTML attributes for block elements. The parser function You can also use parser function syntax to place a category tree on a page. This works just like the tag, using a different syntax, e.g. ; options can be specified using the syntax for named template parameters, e.g. . Using the parser function syntax has the advantage that it allows you to use , , and template parameters when specifying the category to show. Some examples: * Using a magic variable to show "this pages" category tree (may be useful on category description pages): }}. * Using a template to specify the category: }} - the name of the root category would be defined by the contents of Template:Root_category. * Using a template parameter to specify the category, when using CategoryTree inside a template: }}} in Template:Baz can be called using The Special: CategoryTree page The special page is called ; there you can enter the name of a category and then browse its content. More information For more information on the CategoryTree extension, see Extension: CategoryTree at MediaWiki.